<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>充值订单</title>
	<link rel="stylesheet" href="css/xingchao.css">
    <link rel="stylesheet" href="css/jquery.page.css">
	<link rel="stylesheet" href="css/bootstrap-new.css">
	<link rel="stylesheet" href="css/zy.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/layer/layer.js"></script>
    <script type="text/javascript" src="js/jquery.page.js"></script>
    <script type="text/javascript" src="js/qrcode.min.js"></script>
    <style type="text/css">
		#wxPayBtn:hover{
			cursor: pointer;
		}
    </style>
</head>
<body style="background: #EFEFEF;">

<!--  
	头部
-->
<div class="head">
	<div class="w" style="height:50px;">
		<a href="index.html">
			<img src="images/logo.png" alt="" width="150px;">
		</a>
		<ul class="nav r">
	       <li class="cur">
	            <a href="index.html">众源</a>
	            <sub class="sub1"></sub>
	        </li>
	        <li>
	            <a href="ziyuan.html">资源搜索</a>
	            <sub class="sub1"></sub>
	        </li>
	        <li>
	            <a href="jiaocheng.html">使用教程</a>
	            <sub class="sub1"></sub>
	        </li>
	        <!--
            <li>
                <a href="biaozhun.html" data-localize='top.API'>领域图谱</a>
                <sub class="sub1"></sub>
            </li>
            -->
	        <li>
	            <a href="page.html">关于我们</a>
	            <sub class="sub1"></sub>
	        </li>
	        <li id='userbox'>
	            <a href="user.html" id="user-box">会员中心</a>|<a href="user.html?action=out">退出</a>
	            <sub class="sub1"></sub>
	        </li>
	        <li id="langBox">
                <a href="javascript:void(0)" data-lang='zh-CN'>中</a>&nbsp;|
                <a href="javascript:void(0)" data-lang="en-US">EN</a>
                <sub class="sub1"></sub>
            </li>
		</ul>
	</div>
</div>

<div class="main w" style="margin-top: 50px">
	<div class="container" style="display:none">
		<div class="row">
		   <div class="col-md-6 col-md-offset-3" style="background-color:#ddd;">
			<h3><b>创建充值订单</b></h3><br/>
			<dl class="dl-horizontal">
			  <dt>订单id:</dt>
			  <dd id="invoiceId"></dd><br/>
			  <dt>充值金额(1元=1众币):</dt>
			  <dd id="price"></dd><br/>
			</dl>
			<!-- <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
				<input name="cmd" type="hidden" value="_xclick">
				<input name="charset" type="hidden" value="utf-8">
				<input name="business" type="hidden" value="jingui@aliyun.com">
				<input name="item_name" type="hidden" value="zyCoin payment">
				<input name="item_number" type="hidden" id="dataKeyInput" value="zy_coin">
				<input name="amount" type="hidden" id="priceInput" value="">
				<input name="quantity" type="hidden" value="1">
				<input name="no_note" type="hidden" value="0">
				<input name="no_shipping" type="hidden" value="1">
				<input name="currency_code" type="hidden" value="USD">
				<input name="invoice" type="hidden" id="orderIdInput" value="">
				<input name="cancel_return" type="hidden" value="http://www.usources.cn/canceled.html">
				<input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src=" https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" style="display:table;margin:10px auto">
				<img width="1" height="1" alt="" src=" https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0">
			</form> -->
			<img src="images/wxpay.png" height="120px" id="wxPayBtn" style="display:table;margin:10px auto;"/>
		   </div>
		</div>
	</div>
</div>
<div id="qrcode" style="width:200px;height:200px;display:none;margin:20px auto;background-repeat: no-repeat;"></div>
<!--  
	底部
-->
<div class="copyright">
	Copyright @ 2016-2017 语义(上海)信息科技有限公司 &nbsp;&nbsp;&nbsp;&nbsp;
</div>

</body>
</html>
<script type="text/javascript" src="js/App.min.js"></script>
<script type="text/javascript">
	var waitTime=60;
	function checkChargeOrder(invoiceId){
		if(waitTime == 0){
			layer.open({
				content: "支付超时"
				,btn: ['确认']
				,yes: function(index, layero){
					location.href="bill.html";
				}
			});
		}else{
			getOrderStatus(invoiceId);
			waitTime--;
			setTimeout(function() {checkChargeOrder(invoiceId)},1000)
		}
	}
	function getOrderStatus(invoiceId){
		$.ajax({
			url:"http://www.usources.cn/api/user/checkChargeOrder",
			type:'GET',
			xhrFields: {
				withCredentials: true
		},
		crossDomain:true,
		data:{"invoiceId":invoiceId},
		success:function(data){
			if(data.code == 1003){
				layer.open({
					content: "您尚未登录"
					,btn: ['确认']
					,yes: function(index, layero){
						location.href="login.html";
					}
				});
			}else if(data.code == 200){
				if(data.data.info.orderStatus==1){
					location.href="bill.html";
				}
			}
		},
		error:function(error){
			console.log(error);
			layer.msg('服务异常,请稍后重试',{icon:2});
		},dataType:'json'});
	}
</script>